package org.dromara.cms.domain.bo;

import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.cms.domain.CmsModelField;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;

/**
 * CMS扩展字段业务对象 cms_model_field
 *
 * @author Spring
 * @date 2024-12-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = CmsModelField.class, reverseConvertGenerate = false)
public class CmsModelFieldBo extends BaseEntity {

    /**
     * 字段ID
     */
    @NotNull(message = "字段ID不能为空", groups = {EditGroup.class})
    private Long id;

    /**
     * 字段名称
     */
    @NotBlank(message = "字段名称不能为空", groups = {AddGroup.class, EditGroup.class})
    private String fieldName;

    /**
     * 字段标识
     */
    @NotBlank(message = "字段标识不能为空", groups = {AddGroup.class, EditGroup.class})
    private String fieldKey;

    /**
     * 字段类型(text/textarea/number/date/select/radio/checkbox/image/file)
     */
    @NotBlank(message = "字段类型(text/textarea/number/date/select/radio/checkbox/image/file)不能为空", groups = {AddGroup.class, EditGroup.class})
    private String fieldType;

    /**
     * 默认值
     */
    private String defaultValue;

    /**
     * 是否必填(0否 1是)
     */
    @NotNull(message = "是否必填(0否 1是)不能为空", groups = {AddGroup.class, EditGroup.class})
    private Long required;

    /**
     * 应用模型(article/page/category)
     */
    @NotBlank(message = "应用模型(article/page/category)不能为空", groups = {AddGroup.class, EditGroup.class})
    private String modelType;

    /**
     * 排序号
     */
    @NotNull(message = "排序号不能为空", groups = {AddGroup.class, EditGroup.class})
    private Long sort;

    /**
     * 输入提示
     */
    @NotBlank(message = "输入提示不能为空", groups = {AddGroup.class, EditGroup.class})
    private String placeholder;

    /**
     * 验证规则
     */
    private String validateRule;

    /**
     * 状态(0正常 1停用)
     */
    @NotBlank(message = "状态(0正常 1停用)不能为空", groups = {AddGroup.class, EditGroup.class})
    private String status;

    /**
     * 备注
     */
    private String remark;


}
